#pragma once

#include "windows.h"
#include <map>
using namespace std;

class IBase
{
    static ULONG m_dwTotalMemoryUsed;
    static map<LPVOID, size_t> memMap;
public:
    virtual ~IBase() {};
    /*LPVOID operator new(size_t size)
    {     
        m_dwTotalMemoryUsed+=size;
        LPVOID ptr = malloc(size);
        memMap[ptr] = size;
        return ptr;
    }
    void operator delete(LPVOID p)
    {
        m_dwTotalMemoryUsed -= memMap[p];
        memMap.erase(memMap.find(p));
        free(p);
    }*/
    static ULONG GetTotalMemory() 
    {
        return m_dwTotalMemoryUsed;
    }
};

__declspec(selectany) map<LPVOID, size_t> IBase::memMap;

__declspec(selectany) ULONG IBase::m_dwTotalMemoryUsed;
